unit uniAudio;

interface

uses
  Classes;

const
  NUM_EXPLO = 2;
  NUM_EXPLO_POP = 6;
  MAX_MUSIC = 32;

type

  SoundType =
    (
    HeroAmmo00, //**< unused */
    PowerUp, //**< power up sound */
    Explosion, //**< standard explosion */
    ExploPop, //**< 'light' explosion */
    ExploBig, //**< deep, long explosion */
    AddLife, //**< new ship earned */
    LoseLife, //**< ship lost */
    MusicGame, //**< gameplay music */
    MusicMenu, //**< menu music */
    NumSoundTypes //**< total number of sounds available */
    );

  { Audio }

  Audio = class(TObject)
  public

    //const char	*fileNames[NumSoundTypes];	//**< base filenames for sound effects */
    fileNames: array[0..Integer(NumSoundTypes) - 1] of string;
    //SDL_CD	*cdrom; 					//**< pointer to CDROM struct. Is void* if not using SDL */
    cdrom: Pointer;
    //char	musicFile[MAX_MUSIC][256];	//**< array of filenames for playlist */
    musicFile: array[0..MAX_MUSIC - 1] of string;

    musicMax: Integer; //**< max number of user-defined songs (CD or playlist) */
    musicIndex: Integer; //**< current track ( 0 < musicIndex < musicMax ) */

    constructor Create;
    destructor Destroy; override;
    {
    virtual void	update();
    virtual void	playSound(SoundType type, float *pos, int age = 0);
    virtual void	stopMusic();
    virtual void	pauseGameMusic(bool);
    virtual void	setMusicMode(SoundType);
    virtual void	setMusicVolume(float);
    virtual void	setSoundVolume(float);
    virtual void	setMusicIndex(int);
    virtual void	nextMusicIndex();

    virtual void	initSound();
    virtual void	initCDROM();
    }
    procedure update; virtual;
    procedure playSound(_type: SoundType; pos: array of Single; age: Integer = 0); virtual;
    procedure stopMusic;virtual;
    procedure pauseGameMusic(temp: boolean);virtual;
    procedure setMusicMode(temp: SoundType);virtual;
    procedure setMusicVolume(temp: Single);virtual;
    procedure setSoundVolume(temp: Single);virtual;
    procedure setMusicIndex(temp: Integer);virtual;
    procedure nextMusicIndex;virtual;

    procedure initSound;virtual;
    procedure initCDROM;virtual;
  end;

  //**
  // * node class used for 'audio queue'
  //*/
  //======================================

  { SoundInfo }

  SoundInfo = class(TObject)
  public
    _type: SoundType;
    pos: array[0..2] of Single;
    age: Integer;
    next: SoundInfo;
    back: SoundInfo;
    constructor Create; overload;
    constructor Create(t: SoundType; p: array of Single; a: Integer); overload;
    destructor Destroy; override;
  end;



implementation

uses
  uniConfig;

{ Audio }

constructor Audio.Create;
var
  _config: Config;
begin
  _config := instance;

  fileNames[Integer(HeroAmmo00)] := 'wav/boom.wav';
  fileNames[Integer(PowerUp)] := 'wav/power.wav';
  fileNames[Integer(Explosion)] := 'wav/exploStd.wav';
  fileNames[Integer(ExploPop)] := 'wav/exploPop.wav';
  fileNames[Integer(ExploBig)] := 'wav/exploBig.wav';
  fileNames[Integer(LoseLife)] := 'wav/life_lose.wav';
  fileNames[Integer(AddLife)] := 'wav/life_add.wav';
  fileNames[Integer(MusicGame)] := 'wav/music_game.wav';
  fileNames[Integer(MusicMenu)] := 'wav/music_menu.wav';

  cdrom := nil;
  musicMax := 1;
  musicIndex := 0;

  if (_config.audioEnabled = true) then
  begin
    initCDROM;
  end;
end;

destructor Audio.Destroy;
begin
  inherited;
end;

procedure Audio.pauseGameMusic(temp: boolean);
begin

end;

procedure Audio.update;
begin

end;

procedure Audio.playSound(_type: SoundType; pos: array of Single; age: Integer);
begin

end;

procedure Audio.initCDROM;
begin
  cdrom := nil;
end;

procedure Audio.initSound;
begin

end;

procedure Audio.nextMusicIndex;
begin

end;

procedure Audio.setMusicIndex(temp: Integer);
begin

end;

procedure Audio.setMusicMode(temp: SoundType);
begin

end;

procedure Audio.setMusicVolume(temp: Single);
begin

end;

procedure Audio.setSoundVolume(temp: Single);
begin

end;

procedure Audio.stopMusic;
begin

end;

{ SoundInfo }

constructor SoundInfo.Create;
begin

end;

constructor SoundInfo.Create(t: SoundType; p: array of Single; a: Integer);
begin

end;

destructor SoundInfo.Destroy;
begin

  inherited;
end;

end.

